package org.naivecode.audio.spectrum;

import java.util.ArrayList;
import java.util.List;

import org.naivecode.audio.io.PcmDataProvider;

public class SpectrumExtractor {
	private static final int FREQUENCY_RESOLUTION = 1024;
	
	private final PcmDataProvider pcmDataInput;
	private final int frameOverlap;
	private final int frameSize;

	private final float[] framePcm;
	private final float[] windowedFramePcm;
	private final List<Frame> bufferedFrames;
	private SpectrumFrameEventListener spectrumListener;

	public SpectrumExtractor(PcmDataProvider data, int fOverlap, int fSize,
			int framesBuffered) {
		pcmDataInput = data;
		frameOverlap = fOverlap;
		frameSize = fSize;
		framePcm = new float[FREQUENCY_RESOLUTION];
		windowedFramePcm = new float[FREQUENCY_RESOLUTION];
		bufferedFrames = new ArrayList<SpectrumExtractor.Frame>();
	}

	public void start() {
	}

	private void windowFrame() {

	}

	private Frame processPcmData() {
		return null;
	}

	private static class Frame {
		public final float[] data;

		public Frame(float[] data) {
			super();
			this.data = data;
		}
	}
}
